package com.si.controller.manage;

/**
 * @author 阿良
 * @version 1.0.0
 * @ClassName LogController.java
 * @Description TODO
 * @createTime 2020年03月25日 18:48:00
 */

import com.si.entity.Info;
import com.si.entity.InfoTypeClassA;
import com.si.entity.OperationLog;
import com.si.service.OperationLogService;
import com.si.util.Paging;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("log/manage")
public class LogController {
  @Autowired
  private OperationLogService operationLogService;
  /**
   *
   * @return
   */
  @RequestMapping(value="list")
  public String list(
          ModelMap modelMap,
          @RequestParam(value = "curPage", defaultValue = "0", required = false) Integer curPage,
          @RequestParam(value = "pageSize", defaultValue = "10", required = false) Integer pageSize,
          @RequestParam(value = "keywords", required = false) String keywords) {

    Map<String, Object> parameterMap=new HashMap<String, Object>();
    if(StringUtils.isNoneBlank(keywords)) {
      parameterMap.put("%operationdetails%", keywords);
    }
    Map<String, Object> orderMap=new HashMap<String, Object>();
    orderMap.put("operationtime", "desc");
    Paging<OperationLog> paging = operationLogService.createQueryPaging(parameterMap, orderMap, curPage, pageSize);
    modelMap.put("paging", paging);
    modelMap.put("keywords", keywords);
    return "managePage/log/list";
  }
}
